﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AdminSite.Master"
    Inherits="System.Web.Mvc.ViewPage<Veteran_cms.Models.tag>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <!-- Validation form -->
    <%using (Html.BeginForm("Create", "ManageTag", FormMethod.Post, new { enctype = "multipart/form-data", @class = "form", id = "validate" }))
      { %>
    <!-- Multiple files uploader -->
    <fieldset>
        <div class="widget">
            <div style="float: right">
                <a href="<%=Url.Action("IndexTag","ManageTag") %>" title="" class="backTo" style="margin: 5px;">
                    <img src="../../images/adminSite/icons/prev.png" alt="" class="icon" /><span>Trở về</span></a></div>
            <div class="title">
                <img src="../../Images/adminSite/icons/dark/pencil.png" alt="" class="titleIcon" /><h6>
                    Thông tin Tag</h6>
            </div>
            <%if (ViewData["Msg"] != null)
              {%>
            <div class="nNote nSuccess hideit">
                <p>
                    <strong>
                        <%=ViewData["Msg"]%></strong></p>
            </div>
            <%} %>
            <div class="formRow">
                <label>
                    Tiêu đề:<span class="req">*</span></label>
                <div class="formRight">
                    <%:Html.TextBoxFor(model => model.tag_text, new { @class = "validate[required,maxSize[255]]", id = "req", onblur = "return CheckName()" })%></div>
                    <div id="dvName" style="visibility:collapse"> <span class="req"><label id="lbl"></label>: đã tồn tại</span></div>
                <div class="clear">
                </div>
            </div>
              <div class="formSubmit">
                <input type="submit" value="cập nhật" class="blueB" onclick="return CheckName()"/></div>
                 <div class="formSubmit">
                <input type="reset" value="Xóa trắng" class="redB" /></div>
           
            <div class="clear">
            </div>
        </div>
            <%} %>
            
            
        
    </fieldset>
      <script type="text/javascript">

          function CheckName() {
              var name = $("#req").val();
              $.post("/ManageTag/CheckName/", { name: name },
	                    function (data) {
	                        if (data === "True") {
	                            $('#dvName').css("visibility", "collapse");
	                            return true;
	                        }
	                        else {
	                            $('#dvName').css("visibility", "visible");
	                            document.getElementById('lbl').innerHTML = name;
	                            $("#req").val("");
	                            return false;
	                        }
	                    });
          }
          

	    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleAreaPlaceHolder" runat="server">
</asp:Content>
